<template>
    <view>
        <!--        <view class="page" v-if="userArray.length == 0"> 暂无商家  </view>-->
        <view class="page">
            <view>
                正式成员
            </view>
            <view class="cu-list menu-avatar" v-for="(item, index) in userArray1" :key="index">

                <view>
                    名称：
                    {{item.Sp_user.name}}
                </view>

                <view class="padding flex flex-direction">
                    <button class="cu-btn bg-red margin-tb-sm lg" @tap="del(item.Sp_user.id)">删除</button>
                </view>

            </view>
            <!-- <view class="padding flex flex-direction">
                <button class="cu-btn bg-red margin-tb-sm lg" @tap="goDianPu">嫣红</button>
            </view> -->

            <view>
                申请成员
            </view>
            <view class="cu-list menu-avatar" v-for="(item, index) in userArray2" :key="index">

                <view>
                    名称：
                    {{item.Sp_user.name}}
                </view>

                <view class="padding flex flex-direction">
                    <button class="cu-btn bg-red margin-tb-sm lg" @tap="del((item.Sp_user.id))">拒绝</button>
                </view>

                <view class="padding flex flex-direction">
                    <button class="cu-btn bg-red margin-tb-sm lg" @tap="sure((item.Sp_user.id))">同意</button>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                userArray : []
            };
        },
        async onLoad(e) {
            let userInfo = this.$store.state.user;
            let stuts1 = await this.$httpApi.query({
                '[]':{
                    "Sp_user":{
                        "dianpu":userInfo.dianbu_id,
                        "status":1, //审核过的
                    }
                }
            });
            let stuts2 = await this.$httpApi.query({
                '[]':{
                    "Sp_user":{
                        "dianpu":userInfo.dianbu_id,
                        "status":0, //未审核过的
                    }
                }
            });
            //  data['[]']   等价于  data.[]   // [] 是特殊字符报错必须用这种形式。
            console.log(data);
            this.userArray1 = stuts1['[]'] ;
            this.userArray2 = stuts1['[]'] ;

        },
        methods: {

            ruzhu: function(id) {
                console.log("你进来了吗"+id);
                // this.navigateTo('pages/detail/detail?id='+id ,'1231');
            },

            del:function (id) { //拒绝 移除
                this.$httpApi.update()
            },
            sure:function (id) { //修改
                this.$httpApi.update()
            }
        }
    }
</script>

<style>
    .cu-form-group .title {
        min-width: calc(4em + 15px);
    }

    .page {
        height: 100Vh;
        width: 100vw;
    }

    .page.show {
        overflow: hidden;
    }

    .switch-sex::after {
        content: "\e716";
    }

    .switch-sex::before {
        content: "\e7a9";
    }

    .switch-music::after {
        content: "\e66a";
    }

    .switch-music::before {
        content: "\e6db";
    }
</style>
